/**
 * @ClassName LC922
 * @Author ykx
 * @Date 2024/6/30 17:59
 * @Version 1.0
 */
public class LC922 {
    public static void main(String[] args) {

    }

    public int[] sortArrayByParityII(int[] nums) {
        int[] result = new int[nums.length];
        int even = 0, odd = 1;
        for (int num : nums) {
            if (num % 2 != 0) {
                result[odd] = num;
                odd += 2;
            } else {
                result[even] = num;
                even += 2;
            }
        }
        return result;
    }

}
